3.150 \(\int \sin ^2(e+f x) (a+b \sin (e+f x)) \, dx\)

Optimal. Leaf size=55 \[ -\frac {a \sin (e+f x) \cos (e+f x)}{2 f}+\frac {a x}{2}+\frac {b \cos ^3(e+f x)}{3 f}-\frac {b \cos (e+f x)}{f} \]

[Out]

1/2*a*x-b*cos(f*x+e)/f+1/3*b*cos(f*x+e)^3/f-1/2*a*cos(f*x+e)*sin(f*x+e)/f

________________________________________________________________________________________

Rubi [A]  time = 0.04, antiderivative size = 55, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 4, integrand size = 19, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.210, Rules used = {2748, 2635, 8, 2633} \[ -\frac {a \sin (e+f x) \cos (e+f x)}{2 f}+\frac {a x}{2}+\frac {b \cos ^3(e+f x)}{3 f}-\frac {b \cos (e+f x)}{f} \]

Antiderivative was successfully verified.

[In]

Int[Sin[e + f*x]^2*(a + b*Sin[e + f*x]),x]

[Out]

(a*x)/2 - (b*Cos[e + f*x])/f + (b*Cos[e + f*x]^3)/(3*f) - (a*Cos[e + f*x]*Sin[e + f*x])/(2*f)

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 2633

Int[sin[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> -Dist[d^(-1), Subst[Int[Expand[(1 - x^2)^((n - 1)/2), x], x], x
, Cos[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[(n - 1)/2, 0]

Rule 2635

Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> -Simp[(b*Cos[c + d*x]*(b*Sin[c + d*x])^(n - 1))/(d*n),
x] + Dist[(b^2*(n - 1))/n, Int[(b*Sin[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1] && Integer
Q[2*n]

Rule 2748

Int[((b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Dist[c, Int[(b*S
in[e + f*x])^m, x], x] + Dist[d/b, Int[(b*Sin[e + f*x])^(m + 1), x], x] /; FreeQ[{b, c, d, e, f, m}, x]

Rubi steps

\begin {align*} \int \sin ^2(e+f x) (a+b \sin (e+f x)) \, dx &=a \int \sin ^2(e+f x) \, dx+b \int \sin ^3(e+f x) \, dx\\ &=-\frac {a \cos (e+f x) \sin (e+f x)}{2 f}+\frac {1}{2} a \int 1 \, dx-\frac {b \operatorname {Subst}\left (\int \left (1-x^2\right ) \, dx,x,\cos (e+f x)\right )}{f}\\ &=\frac {a x}{2}-\frac {b \cos (e+f x)}{f}+\frac {b \cos ^3(e+f x)}{3 f}-\frac {a \cos (e+f x) \sin (e+f x)}{2 f}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.06, size = 60, normalized size = 1.09 \[ \frac {a (e+f x)}{2 f}-\frac {a \sin (2 (e+f x))}{4 f}-\frac {3 b \cos (e+f x)}{4 f}+\frac {b \cos (3 (e+f x))}{12 f} \]

Antiderivative was successfully verified.

[In]

Integrate[Sin[e + f*x]^2*(a + b*Sin[e + f*x]),x]

[Out]

(a*(e + f*x))/(2*f) - (3*b*Cos[e + f*x])/(4*f) + (b*Cos[3*(e + f*x)])/(12*f) - (a*Sin[2*(e + f*x)])/(4*f)

________________________________________________________________________________________

fricas [A]  time = 0.45, size = 46, normalized size = 0.84 \[ \frac {2 \, b \cos \left (f x + e\right )^{3} + 3 \, a f x - 3 \, a \cos \left (f x + e\right ) \sin \left (f x + e\right ) - 6 \, b \cos \left (f x + e\right )}{6 \, f} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(f*x+e)^2*(a+b*sin(f*x+e)),x, algorithm="fricas")

[Out]

1/6*(2*b*cos(f*x + e)^3 + 3*a*f*x - 3*a*cos(f*x + e)*sin(f*x + e) - 6*b*cos(f*x + e))/f

________________________________________________________________________________________

giac [A]  time = 0.15, size = 50, normalized size = 0.91 \[ \frac {1}{2} \, a x + \frac {b \cos \left (3 \, f x + 3 \, e\right )}{12 \, f} - \frac {3 \, b \cos \left (f x + e\right )}{4 \, f} - \frac {a \sin \left (2 \, f x + 2 \, e\right )}{4 \, f} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(f*x+e)^2*(a+b*sin(f*x+e)),x, algorithm="giac")

[Out]

1/2*a*x + 1/12*b*cos(3*f*x + 3*e)/f - 3/4*b*cos(f*x + e)/f - 1/4*a*sin(2*f*x + 2*e)/f

________________________________________________________________________________________

maple [A]  time = 0.16, size = 49, normalized size = 0.89 \[ \frac {-\frac {b \left (2+\sin ^{2}\left (f x +e \right )\right ) \cos \left (f x +e \right )}{3}+a \left (-\frac {\sin \left (f x +e \right ) \cos \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )}{f} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sin(f*x+e)^2*(a+b*sin(f*x+e)),x)

[Out]

1/f*(-1/3*b*(2+sin(f*x+e)^2)*cos(f*x+e)+a*(-1/2*sin(f*x+e)*cos(f*x+e)+1/2*f*x+1/2*e))

________________________________________________________________________________________

maxima [A]  time = 0.65, size = 48, normalized size = 0.87 \[ \frac {3 \, {\left (2 \, f x + 2 \, e - \sin \left (2 \, f x + 2 \, e\right )\right )} a + 4 \, {\left (\cos \left (f x + e\right )^{3} - 3 \, \cos \left (f x + e\right )\right )} b}{12 \, f} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(f*x+e)^2*(a+b*sin(f*x+e)),x, algorithm="maxima")

[Out]

1/12*(3*(2*f*x + 2*e - sin(2*f*x + 2*e))*a + 4*(cos(f*x + e)^3 - 3*cos(f*x + e))*b)/f

________________________________________________________________________________________

mupad [B]  time = 8.57, size = 68, normalized size = 1.24 \[ \frac {a\,x}{2}-\frac {-a\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^5+4\,b\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^2+a\,\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )+\frac {4\,b}{3}}{f\,{\left ({\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^2+1\right )}^3} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sin(e + f*x)^2*(a + b*sin(e + f*x)),x)

[Out]

(a*x)/2 - ((4*b)/3 + a*tan(e/2 + (f*x)/2) - a*tan(e/2 + (f*x)/2)^5 + 4*b*tan(e/2 + (f*x)/2)^2)/(f*(tan(e/2 + (
f*x)/2)^2 + 1)^3)

________________________________________________________________________________________

sympy [A]  time = 0.74, size = 92, normalized size = 1.67 \[ \begin {cases} \frac {a x \sin ^{2}{\left (e + f x \right )}}{2} + \frac {a x \cos ^{2}{\left (e + f x \right )}}{2} - \frac {a \sin {\left (e + f x \right )} \cos {\left (e + f x \right )}}{2 f} - \frac {b \sin ^{2}{\left (e + f x \right )} \cos {\left (e + f x \right )}}{f} - \frac {2 b \cos ^{3}{\left (e + f x \right )}}{3 f} & \text {for}\: f \neq 0 \\x \left (a + b \sin {\relax (e )}\right ) \sin ^{2}{\relax (e )} & \text {otherwise} \end {cases} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(f*x+e)**2*(a+b*sin(f*x+e)),x)

[Out]

Piecewise((a*x*sin(e + f*x)**2/2 + a*x*cos(e + f*x)**2/2 - a*sin(e + f*x)*cos(e + f*x)/(2*f) - b*sin(e + f*x)*
*2*cos(e + f*x)/f - 2*b*cos(e + f*x)**3/(3*f), Ne(f, 0)), (x*(a + b*sin(e))*sin(e)**2, True))

________________________________________________________________________________________